Objects Reference

class sound : public base_object

Definition

class sound : public base_object
{
  public:
  int total_time;
  LPDIRECTSOUNDBUFFER buf;
  LPDIRECTSOUND3DBUFFER buf3d;

  sound()
  { buf=0; buf3d=0; total_time=0; };

  virtual ~sound()
  { reset(); };

  void reset()
  {
    if (buf3d) buf3d->Release(); buf3d=0;
    if (buf) buf->Release(); buf=0;
    total_time=0;
  }

  int load_wav(char *filename);
  sound *clone();
};

Data Members

Member Type Description
total_time int the sound length in ms
buf LPDIRECTSOUNDBUFFER the DirectX sound buffer
buf3d LPDIRECTSOUND3DBUFFER the DirectX sound buffer 3D

Methods

reset, load_wav, clone

Remarks

This class implements raw sound data. The sound can be loaded from a .wav file.
For playing multiple instances of the same sound, you must clone it and play the clones.

See Also

base_object, directX